<template>
  <div class="max">
    <my-header :backBtn="true">
      <div slot="title">
        反馈内容
      </div>
    </my-header>
    <div class="cont-nof">
      <article class="weui-article tl">
        <section>
          <section>
            <h3>{{article.title}}</h3>
            <p class="tj article-cont" v-html="article.content"></p>
            <p class="tc" v-if="article.imageUrl">
              <img :src="article.imageUrl" @click="previewImage(article.imageUrl)" style="width: 100%;">
            </p>
            <h3 style="font-weight: normal;" class="tr">{{article.createTime}}</h3>
            <h3 style="font-weight: normal" class="tr">反馈人：{{article.kinsfolkName}}</h3>
          </section>
        </section>
      </article>
    </div>
  </div>
</template>

<script>
  import wx from "weixin-js-sdk";

  export default {
    data() {
      return {
        article: {},
        type: '',
      }
    },
    methods: {
      getWxConfig() {
        let url = window.location.href;
        let _this = this;
        _this.$http.fetchWxConfig({
          url: url
        }).then(resp => {
          wx.config({
            // debug: true,
            appId: resp.data.appId,
            timestamp: resp.data.timestamp, // 必填，生成签名的时间戳
            nonceStr: resp.data.noncestr, // 必填，生成签名的随机串
            signature: resp.data.sign, // 必填，签名
            jsApiList: ['previewImage'] // 必填，需要使用的JS接口列表
          });
        })
      },
      previewImage(url) {
        wx.previewImage({
          previewImage: url,
          urls: [url]
        })
      },
    },
    created() {
      this.article = this.$route.query;
      this.getWxConfig();
      let loginType = this.$Cookies.get('loginType');
      if (loginType === 'kindergarten') {
        this.$http.readKinsfolkFeedback(this.article);
      }
    }
  }
</script>

<style scoped>
  .article-cont {
    text-indent: 1.5rem
  }
</style>
